
forvalues b = 1/$B {

  * Import POF
  use "${analysis}/data/2_2_pof_clean.dta", clear

  * Set instance-round-specific seed and bootstrap clusters
  local my_seed = `pll_instance'*1000 + `b'
  set seed `my_seed'
  bsample, strata(region) cluster(psu_id)

  * Estimate the reservation wage equation
  capture qreg ln_winc_employee $covariates [pweight = pweight], quantile(.10) wlsiter(50) iterate(800) vce(robust, chamberlain)
  
  * If it works
  if _rc==0 {
      
    * Store the reservation wage model estimated this round
    estimates save "${analysis}/results/estimations/temp/reservation_wages/`pll_instance'_`b'.ster", replace
    estimates drop _all
    
    * And use the same data to estimate the potential wage with Heckman's selection correction
    svyset psu_id [pweight = pweight], strata(strata_id) singleunit(centered) vce(linearized) 
    capture svy: heckman ln_winc_employee $wage_covariates, select($covariates) 
    
    * Store the potential wage model estimated this round
    capture estimates save "${analysis}/results/estimations/temp/potential_wages/`pll_instance'_`b'.ster", replace
    estimates drop _all
    
    }
    
}
